#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<iostream>
using namespace std;
int main()
{
	int year_num;
	scanf("%d", &year_num);
	if (year_num > 1582)
	{
		if ((year_num % 4 == 0 && year_num % 100 != 0) || (year_num % 100 == 0 && year_num % 400 == 0))
			cout << 1 << endl;
		else
			cout << 0 << endl;
	}
	return 0;
}